Contents | Index | < Browse | Browse >

LETTERstrncpyULETTER Copies a string, length-limited.

Overview
#include <string.h>

char *strncpy(char *dest, const char *source, size_t n)

char *r;
char *dest;
const char *source;
size_t n;

Portability
ANSI

Description
Copies up to "n" characters from the string "source" into "dest" and adds a terminating zero byte, which is why the function only copies n-1 chars. If "source"'s length is smaller than "n", "dest" is appended with additonal zero bytes until it is exactly "n" characters long.

Returns
A pointer to the destination string.

See also
strcpy